const div = dom.create('<div>newDiv</div>');

console.log(div)

dom.after(test, div)

const div3 = dom.create('<div id="parent"></div>')
dom.wrap(test, div3)

const nodes = dom.empty(window.empty)
console.log(nodes)

dom.attr(test, 'title', 'Hi, this is kobayashi')
// 在id 为test 的标签中写入title 属性值：Hi this is kobayashi
const title = dom.attr(test, 'title')
// 读取 title 值
console.log(`title:${title}`)

dom.text(test, '你好，我更改了这个文本内容')
let cnt = dom.text(test)
console.log(cnt)

dom.style(test, {border: '1px solid red', color: 'blue'})   //设置style 1
dom.style(test, 'border')   // 读取style
dom.style(test, 'border', '1px solid red')  // 设置style 2
console.log(dom.style(test, 'color'))  // blue


dom.class.add(test, 'red')
dom.class.add(test, 'blue')
dom.class.remove(test, 'blue')
console.log(dom.class.has(test, 'red'))     // true
console.log(dom.class.has(test, 'blue'))    // false


let fn = ()=>{console.log('点击了')}
dom.on(test, 'click', fn)
dom.off(test, 'click', fn)


const testDiv = dom.find('#test')[0]
console.log(testDiv)
const test2 = dom.find('#test2')[0]
console.log(dom.find('.red', test2)[0])

s2 = dom.find('#s2')[0]
console.log(dom.parent(test))
console.log(dom.siblings(s2))
console.log(dom.next(s2))
console.log(dom.previous(s2))

t = dom.find('#travel')[0]
dom.each(dom.children(t), (n)=>dom.style(n, 'color', 'red'))
// 找到id 为travel 的节点，将其文字颜色改变

console.log(dom.index(s2))